package com.ayou.eggguard.farm.mapper;

import com.ayou.eggguard.farm.pojo.Doctor;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface DoctorMapper {
    List<Doctor> getDoctors(String doctorName);

    @Insert("insert into doctor(doctor_name, doctor_type, doctor_number, doctor_gender, doctor_age, doctor_level, doctor_emp, doctor_skill, doctor_contact) " +
            "values(#{doctorName},#{doctorType},#{doctorNumber},#{doctorGender},#{doctorAge},#{doctorLevel},#{doctorEmp},#{doctorSkill},#{doctorContact})")
    void add(Doctor doctor);

    @Update("update doctor set doctor_name=#{doctorName},doctor_type=#{doctorType},doctor_number=#{doctorNumber}," +
            "doctor_gender=#{doctorGender},doctor_age=#{doctorAge},doctor_level=#{doctorLevel}," +
            "doctor_emp=#{doctorEmp},doctor_skill=#{doctorSkill},doctor_contact=#{doctorContact} where id=#{id}")
    void update(Doctor doctor);

    @Delete("delete from doctor where id=#{id}")
    void delete(Integer id);
}
